using System;
using DnsService.Interfaces;

namespace DnsService.Events
{
    /// <summary>
    /// Socket服务器事件参数基类
    /// 作者：huobing
    /// </summary>
    public abstract class SocketEventArgs : EventArgs
    {
        /// <summary>
        /// 事件时间戳
        /// </summary>
        public DateTime Timestamp { get; set; }
        
        /// <summary>
        /// 事件消息
        /// </summary>
        public string? Message { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        protected SocketEventArgs()
        {
            Timestamp = DateTime.Now;
        }
    }

    /// <summary>
    /// Socket服务器事件参数
    /// 作者：huobing
    /// </summary>
    public class SocketServerEventArgs : SocketEventArgs
    {
        /// <summary>
        /// 服务器端口
        /// </summary>
        public int Port { get; set; }
        
        /// <summary>
        /// 服务器状态
        /// </summary>
        public string? Status { get; set; }
    }

    /// <summary>
    /// Socket客户端事件参数
    /// 作者：huobing
    /// </summary>
    public class SocketClientEventArgs : SocketEventArgs
    {
        /// <summary>
        /// 客户端信息
        /// </summary>
        public Models.SocketClientInfo? ClientInfo { get; set; }
        
        /// <summary>
        /// 连接类型（连接/断开）
        /// </summary>
        public string? ConnectionType { get; set; }
    }

    /// <summary>
    /// Socket消息事件参数
    /// 作者：huobing
    /// </summary>
    public class SocketMessageEventArgs : SocketEventArgs
    {
        /// <summary>
        /// 客户端信息
        /// </summary>
        public Models.SocketClientInfo? ClientInfo { get; set; }
        
        /// <summary>
        /// 消息内容
        /// </summary>
        public new string? Message { get; set; }
        
        /// <summary>
        /// 消息大小（字节）
        /// </summary>
        public int MessageSize { get; set; }
        
        /// <summary>
        /// 消息方向（发送/接收）
        /// </summary>
        public string? Direction { get; set; }
    }

    /// <summary>
    /// Socket错误事件参数
    /// 作者：huobing
    /// </summary>
    public class SocketErrorEventArgs : SocketEventArgs
    {
        /// <summary>
        /// 错误类型
        /// </summary>
        public string? ErrorType { get; set; }
        
        /// <summary>
        /// 异常信息
        /// </summary>
        public Exception? Exception { get; set; }
        
        /// <summary>
        /// 客户端ID（如果与客户端相关）
        /// </summary>
        public string? ClientId { get; set; }
    }
}